
// 图形库
#include <graphics.h>
// 标准库
#include <math.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>

#define PI 3.14159265358979323846
using namespace std;


void drawMovedAttitude(int width, int length, float cx, float cy, float move_cx, float move_cy, float radius, float angle, float updown)		//绘制底部会移动旋转的蓝棕色刻度
{
	
	// 核心修改：添加比例因子（基于原始radius=400）
	const float scale = radius / 400.0f;
	
	setcolor(WHITE);
	setfillcolor(WHITE);
	
	// 创建临时图像（尺寸自动适配）
	const int imgWidth = width;
	const int imgHeight = length;
	PIMAGE pimg = newimage(imgWidth, imgHeight);
	
	settarget(pimg);
	setbkcolor(TRANSPARENT);
	cleardevice();
	
	// 图像中心坐标（基于输入参数动态计算）
	const float centerX = imgWidth / 2.0f;
	const float centerY = imgHeight / 2.0f;
	
	
	setcolor(EGERGB(5, 55, 125));
	setfillcolor(EGERGB(5, 55, 125));
	ege_fillrect(centerX - 200 * scale, centerY - 170 * scale, 400 * scale, 200 * scale);
	
	
	setcolor(EGERGB(38, 25, 10));
	setfillcolor(EGERGB(38, 25, 10));
	ege_fillrect(centerX - 200 * scale, centerY + 30 * scale, 400 * scale, 200 * scale);
	
	
	setcolor(WHITE);
	setfillcolor(WHITE);
	setlinestyle(SOLID_LINE, 0, 2 * scale);
	ege_line(centerX - 200 * scale, centerY + 30 * scale, centerX + 200 * scale, centerY + 30 * scale);
	
	//绘制指示刻度
	
	setcolor(WHITE);
	setfillcolor(WHITE);
	// 文字标注（位置和字体参数化）
	LOGFONTW lf;
	ZeroMemory(&lf, sizeof(LOGFONTW));
	lf.lfHeight = 15 * scale;  // 原文字高度18像素参数化
	lstrcpyW(lf.lfFaceName, L"Arial");
	setfont(&lf);
	
	int x = centerX;
	int y = centerY + 30 * scale;
	int judgeY = move_cy + 30 * scale;
	
	
	for (int i = 1; i <= 20; i++)
	{
		if (i % 4 == 1 && judgeY - i * 10 * scale > cy- 50 * scale)
		{
			setlinestyle(SOLID_LINE, 0, 1 * scale);
			ege_line(x - 10 * scale, y - i * 10 * scale, x + 10 * scale, y - i * 10 * scale);
		}
		
		if (i % 4 == 2 && judgeY - i * 10 * scale > cy - 50 * scale)
		{
			setlinestyle(SOLID_LINE, 0, 2 * scale);
			ege_line(x - 20 * scale, y - i * 10 * scale, x + 20 * scale, y - i * 10 * scale);
		}
		
		if (i % 4 == 3 && judgeY - i * 10 * scale > cy - 50 * scale)
		{
			setlinestyle(SOLID_LINE, 0, 1 * scale);
			ege_line(x - 10 * scale, y - i * 10 * scale, x + 10 * scale, y - i * 10 * scale);
		}
		
		if (i % 4 == 0 && judgeY - i * 10 * scale > cy - 50 * scale)
		{
			setlinestyle(SOLID_LINE, 0, 2 * scale);
			ege_line(x - 45 * scale, y - i * 10 * scale, x + 45 * scale, y - i * 10 * scale);
			
			int value = i * 2.5;
			wchar_t buffer[16];
			swprintf(buffer, L"%d", value);
			ege_outtextxy(x - 66 * scale, y - i * 10 * scale - 8 * scale, buffer);
			ege_outtextxy(x + 55 * scale, y - i * 10 * scale - 8 * scale, buffer);
		}
	}
	
	for (int i = 1; i <= 20; i++)
	{
		if (i % 4 == 1 && judgeY + i * 10 * scale < cy + 110 * scale)
		{
			setlinestyle(SOLID_LINE, 0, 1 * scale);
			ege_line(x - 10 * scale, y + i * 10 * scale, x + 10 * scale, y + i * 10 * scale);
		}
		
		if (i % 4 == 2 && judgeY + i * 10 * scale < cy + 110 * scale)
		{
			setlinestyle(SOLID_LINE, 0, 2 * scale);
			ege_line(x - 20 * scale, y + i * 10 * scale, x + 20 * scale, y + i * 10 * scale);
		}
		
		if (i % 4 == 3 && judgeY + i * 10 * scale < cy + 110 * scale)
		{
			setlinestyle(SOLID_LINE, 0, 1 * scale);
			ege_line(x - 10 * scale, y + i * 10 * scale, x + 12 * scale, y + i * 10 * scale);
		}
		
		if (i % 4 == 0 && judgeY + i * 10 * scale < cy + 110 * scale)
		{
			setlinestyle(SOLID_LINE, 0, 2 * scale);
			ege_line(x - 45 * scale, y + i * 10 * scale, x + 45 * scale, y + i * 10 * scale);
			
			int value = i * 2.5;
			wchar_t buffer[16];
			swprintf(buffer, L"%d", value);
			ege_outtextxy(x - 66 * scale, y + i * 10 * scale - 11 * scale, buffer);
			ege_outtextxy(x + 55 * scale, y + i * 10 * scale - 11 * scale, buffer);
		}
	}
	
	// 旋转绘制 ===================================================
	settarget(NULL);
	putimage_rotatezoom(
		NULL,           // 目标：主屏幕
		pimg,           // 源图像
		move_cx, move_cy,
		0.5f, 0.5f,     // 旋转中心（图像中心）
		angle,          // 旋转角度（弧度）
		1.0f,           // 缩放比例
		true,           // 透明混合
		-1,             // 不修改透明度
		true            // 抗锯齿
		);
	delimage(pimg);
}

void drawScale(float cx, float cy, float radius)
{
	// 核心修改：添加比例因子（基于原始radius=400）
	int scale = radius / 400;
	
	// 图像中心坐标（基于输入参数动态计算）
	const float centerX = cx;
	const float centerY = cy + scale * 45;
	
	float innerRadius = 110.0f * scale;  // 内环半径（原0.8比例）
	
	
	// 刻度参数化 ================================================
	
	// 刻度1（每10度一个）
	setcolor(WHITE);
	for (int i = 0; i < 5; ++i) // 保持原4个刻度
	{
		float baseAngle = 70 * PI / 180;
		float currentAngle = baseAngle + i * PI / 18.0f; // 10度间隔 (PI/18)
		
		if (i != 2) // 对应180度边界条件
		{
			// 刻度线参数化
			float startRadius = innerRadius;
			float endRadius = innerRadius + scale * 8; // 刻度长度占5%半径
			
			int x1 = centerX + startRadius * cos(currentAngle);
			int y1 = centerY - startRadius * sin(currentAngle);
			int x2 = centerX + endRadius * cos(currentAngle);
			int y2 = centerY - endRadius * sin(currentAngle);
			
			// 线宽参数化
			setlinestyle(SOLID_LINE, 0, scale * 2);
			ege_line(x1, y1, x2, y2);
		}
	}
	
	//刻度2（每10度一个）
	for (int i = 0; i < 2; ++i) // 保持原2组刻度
	{
		float baseAngle = 45 * PI / 180;
		float currentAngle = baseAngle + i * PI / 2.0f; // 90度间隔 (PI/18)
		
		// 刻度线参数化
		float startRadius = innerRadius;
		float endRadius = innerRadius + scale * 8;
		
		int x1 = centerX + startRadius * cos(currentAngle);
		int y1 = centerY - startRadius * sin(currentAngle);
		int x2 = centerX + endRadius * cos(currentAngle);
		int y2 = centerY - endRadius * sin(currentAngle);
		
		// 线宽参数化）
		setlinestyle(SOLID_LINE, 0, scale * 2);
		ege_line(x1, y1, x2, y2);
	}
	
	//刻度2（每10度一个）
	for (int i = 0; i < 2; ++i) // 保持原2组刻度
	{
		float baseAngle = 60 * PI / 180;
		float currentAngle = baseAngle + i * PI / 3.0f; // 60度间隔 (PI/3)
		
		// 刻度线参数化
		float startRadius = innerRadius;
		float endRadius = innerRadius + scale * 15;
		
		int x1 = centerX + startRadius * cos(currentAngle);
		int y1 = centerY - startRadius * sin(currentAngle);
		int x2 = centerX + endRadius * cos(currentAngle);
		int y2 = centerY - endRadius * sin(currentAngle);
		
		// 线宽参数化）
		setlinestyle(SOLID_LINE, 0, scale * 2);
		ege_line(x1, y1, x2, y2);
	}
	
	int width = radius / 40;
	
	setcolor(WHITE);
	setfillcolor(WHITE);
	setlinestyle(SOLID_LINE, 0, 2 * scale);
	ege_line(centerX, centerY - radius / 2 + 89 * scale, centerX - width / 2, centerY - radius / 2 + 82 * scale);
	ege_line(centerX, centerY - radius / 2 + 89 * scale, centerX + width / 2, centerY - radius / 2 + 82 * scale);
	ege_line(centerX - width / 2, centerY - radius / 2 + 82 * scale, centerX + width / 2, centerY - radius / 2 + 82 * scale);
	
	int Points[] = { centerX - width / 2, centerY - radius / 2 + 82 * scale,
		centerX + width / 2, centerY - radius / 2 + 82 * scale, centerX, centerY - radius / 2 + 89 * scale,
		centerX - width / 2, centerY - radius / 2 + 82 * scale };
	fillpoly(4, Points);
	
	//putpixel(ix, iy, currentColor);
}


// 判断点(px,py)是否在指定圆角矩形内
int is_in_round_rect(int px, int py, int x, int y, int w, int h, int r)
{
	// 边界检查
	if (px < x || px >= x + w || py < y || py >= y + h) return 0;
	
	// 中间矩形区域（不含圆角）
	if (px >= x + r && px < x + w - r &&
		py >= y + r && py < y + h - r) return 1;
	
	// 检查四个圆角
	int dx, dy;
	
	// 左上角
	if (px < x + r && py < y + r)
	{
		dx = x + r - px;
		dy = y + r - py;
		return dx * dx + dy * dy <= r * r;
	}
	// 右上角
	else if (px >= x + w - r && py < y + r)
	{
		dx = px - (x + w - r);
		dy = y + r - py;
		return dx * dx + dy * dy <= r * r;
	}
	// 右下角
	else if (px >= x + w - r && py >= y + h - r)
	{
		dx = px - (x + w - r);
		dy = py - (y + h - r);
		return dx * dx + dy * dy <= r * r;
	}
	// 左下角
	else if (px < x + r && py >= y + h - r)
	{
		dx = x + r - px;
		dy = py - (y + h - r);
		return dx * dx + dy * dy <= r * r;
	}
	return 1; // 边缘直线部分
}

void draw_rounded_frame(int x, int y, int radius, int hole_w, int hole_h, color_t color)   //绘制挖的圆角矩形
{
	int w = radius, h = radius;
	int r = radius * 0.06;
	int hole_r = radius * 0.05;
	// 计算挖空区域位置（居中）
	int hole_x = x + (w - hole_w) * 0.47;
	int hole_y = y + (h - hole_h) * 0.55;
	
	// 遍历外矩形区域
	for (int i = x; i < x + w; i++)
	{
		for (int j = y; j < y + h; j++)
		{
			// 判断是否在外框且不在挖空区域
			if (is_in_round_rect(i, j, x, y, w, h, r) &&
				!is_in_round_rect(i, j, hole_x, hole_y, hole_w, hole_h, hole_r))
			{
				putpixel(i, j, color);
			}
		}
	}
}

void drawScrew1(int x, int y, double r) {
	// 计算比例因子 (基准r=200)
	double scale = r / 200.0;
	
	setcolor(EGERGB(20, 20, 20));
	setfillcolor(EGERGB(20, 20, 20));
	fillellipse(x + (int)(4 * scale), y + (int)(4 * scale), (int)(17 * scale), (int)(18 * scale));
	
	// 外圈
	setcolor(EGERGB(20, 20, 20));
	circle(x, y, (int)(20 * scale));
	setfillcolor(EGERGB(186, 155, 124));
	fillellipse(x, y, (int)(20 * scale), (int)(20 * scale));
	
	// 中心十字
	setcolor(BLACK);
	setfillcolor(BLACK);
	fillellipse(x, y, (int)(8 * scale), (int)(8 * scale));
	setlinewidth((int)(6 * scale));
	line(x - (int)(14 * scale), y,
		x + (int)(14 * scale), y);
	line(x, y - (int)(14 * scale),
		x, y + (int)(14 * scale));
	
	// 高光效果
	setlinewidth((int)(4 * scale));
	setcolor(EGERGB(200, 170, 130));
	line(x - (int)(14 * scale), y - (int)(6 * scale),
		x - (int)(4 * scale), y - (int)(14 * scale));
	line(x + (int)(12 * scale), y + (int)(2 * scale),
		x + (int)(4 * scale), y + (int)(10 * scale));
	
	setcolor(EGERGB(190, 160, 125));
	line(x + (int)(4 * scale), y - (int)(14 * scale),
		x + (int)(12 * scale), y - (int)(4 * scale));
	
	line(x - (int)(14 * scale), y + (int)(2 * scale),
		x - (int)(4 * scale), y + (int)(10 * scale));
	
	// 中心点
	setcolor(EGERGB(184, 145, 117));
	setfillcolor(EGERGB(184, 145, 117));
	fillellipse(x, y, (int)(3 * scale), (int)(3 * scale));
}



void kuang(float x, float y, float r)  //外框
{
	// 计算比例因子
	float scale = r / 200.0f;
	
	setfillcolor(EGERGB(30, 30, 30));
	ege_fillroundrect(x - 467 * scale, y - 472 * scale, 934 * scale, 944 * scale, 5.0);
	
	setfillcolor(EGERGB(186, 155, 124));
	ege_fillroundrect(x - 465 * scale, y - 470 * scale, 930 * scale, 940 * scale, 5.0);
	//	
	// 绘制背景矩形
	setfillcolor(EGERGB(200, 170, 130));
	ege_fillroundrect(x - 430 * scale, y - 410 * scale, 860 * scale, 840 * scale, 30.0);
	
	//
	setfillcolor(EGERGB(70, 70, 70));
	ege_fillroundrect(x - 410 * scale, y - 408 * scale, 820 * scale, 831 * scale, 30.0);
	
	
	setfillcolor(EGERGB(15, 15, 15));
	ege_point x_y2[] = {
		
		{x - 467 * scale,  y - 475 * scale},
		
		{x - 467 * scale + 934 * scale,  y - 475 * scale},
		
		{x - 467 * scale + 934 * scale,  y - 475 * scale + 103 * scale},
		
		{x - 467 * scale + 934 * scale - 29 * scale,  y - 475 * scale + 103 * scale},
		
		{x - 467 * scale + 934 * scale - 105 * scale,  y - 475 * scale + 30 * scale},
		
		{x + 467 * scale - 934 * scale + 105 * scale,  y - 475 * scale + 30 * scale},
		
		{x + 467 * scale - 934 * scale + 29 * scale,  y - 475 * scale + 103 * scale},
		
		{x + 467 * scale - 934 * scale,  y - 475 * scale + 103 * scale}
	};
	ege_fillpoly(8, x_y2);
	
	
	setfillcolor(EGERGB(184, 145, 117));
	ege_point x_y1[] = {
		
		{x - 465 * scale,  y - 470 * scale},
		
		{x - 465 * scale + 930 * scale,  y - 470 * scale},
		
		{x - 465 * scale + 930 * scale,  y - 470 * scale + 95 * scale},
		
		{x - 465 * scale + 930 * scale - 28 * scale,  y - 470 * scale + 95 * scale},
		
		{x - 465 * scale + 930 * scale - 110 * scale,  y - 470 * scale + 15 * scale},
		
		{x + 465 * scale - 930 * scale + 110 * scale,  y - 470 * scale + 15 * scale},
		
		{x + 465 * scale - 930 * scale + 28 * scale,  y - 470 * scale + 95 * scale},
		
		{x + 465 * scale - 930 * scale,  y - 470 * scale + 95 * scale}
	};
	ege_fillpoly(8, x_y1);
	
	drawScrew1(x - 430 * scale, y - 420 * scale, r / 1.5);
	drawScrew1(x + 430 * scale, y - 420 * scale, r / 1.5);
}

void drawPFDBack(int centerX, int centerY, int radius)//绘制FPD的基础背景
{
	// 核心修改：添加比例因子（基于原始radius=400）
	int scale = radius / 400;
	
	draw_rounded_frame(centerX - radius * 0.56, centerY - radius * 0.56, radius * 1.14, radius * 0.57, radius * 0.55, EGERGB(70, 70, 70));
	draw_rounded_frame(centerX - radius * 0.53, centerY - radius * 0.53, radius * 1.12, radius * 0.48 * 1.1, radius * 0.45 * 1.1, BLACK);
	
	setcolor(WHITE);
	setlinestyle(SOLID_LINE, 0, (int)radius * 0.008);
	ege_line(centerX - radius * 0.1, centerY - radius * 0.39, centerX - radius * 0.1, centerY - radius * 0.47);
	ege_line(centerX + radius * 0.1, centerY - radius * 0.39, centerX + radius * 0.1, centerY - radius * 0.47);
	
	//绘制姿态仪不动的指示部分
	
	setcolor(WHITE);
	setlinestyle(SOLID_LINE, 0, (int)radius * 0.005);
	ege_line(centerX + 2 * scale, centerY + radius * 0.27, centerX + 2 * scale, centerY + radius * 0.3);
	ege_rectangle(centerX - radius * 0.13, centerY + radius * 0.27, radius * 0.03, radius * 0.03);
	ege_rectangle(centerX + radius * 0.1, centerY + radius * 0.27, radius * 0.03, radius * 0.03);
	
	ege_circle(centerX + radius * 0.25, centerY + radius * 0.12 + 10 * scale, radius * 0.01);
	ege_circle(centerX + radius * 0.25, centerY + radius * 0.19 + 10 * scale, radius * 0.01);
	ege_circle(centerX + radius * 0.25, centerY - radius * 0.02 + 10 * scale, radius * 0.01);
	ege_circle(centerX + radius * 0.25, centerY - radius * 0.09 + 10 * scale, radius * 0.01);
	
	setlinestyle(SOLID_LINE, 0, (int)radius * 0.008);
	ege_line(centerX + radius * 0.23, centerY + radius * 0.05 + 10 * scale, centerX + radius * 0.27, centerY + radius * 0.05 + 10 * scale);
	
	setcolor(EGERGB(10, 10, 10));
	setfillcolor(EGERGB(10, 10, 10));
	
	ege_fillcircle(centerX, centerY + radius * 0.05 + 10 * scale, radius * 0.005);
	
	ege_fillrect(centerX - radius * 0.2, centerY + radius * 0.04 + 10 * scale, radius * 0.12, radius * 0.01);
	ege_fillrect(centerX - radius * 0.09, centerY + radius * 0.05 + 10 * scale, radius * 0.01, radius * 0.04);
	
	ege_fillrect(centerX + radius * 0.08, centerY + radius * 0.04 + 10 * scale, radius * 0.12, radius * 0.01);
	ege_fillrect(centerX + radius * 0.08, centerY + radius * 0.05 + 10 * scale, radius * 0.01, radius * 0.04);
	
	
	draw_rounded_frame(centerX - radius * 0.56, centerY - radius * 0.56, radius * 1.14, radius * 0.57, radius * 0.55, EGERGB(70, 70, 70));
	draw_rounded_frame(centerX - radius * 0.53, centerY - radius * 0.53, radius * 1.12, radius * 0.48 * 1.1, radius * 0.45 * 1.1, BLACK);
}

void drawFront(int centerX, int centerY, int radius)
{
	// 核心修改：添加比例因子（基于原始radius=400）
	int scale = radius / 400;
	
	setcolor(WHITE);
	setlinestyle(SOLID_LINE, 0, (int)radius * 0.008);
	ege_line(centerX - radius * 0.1, centerY - radius * 0.39, centerX - radius * 0.1, centerY - radius * 0.47);
	ege_line(centerX + radius * 0.1, centerY - radius * 0.39, centerX + radius * 0.1, centerY - radius * 0.47);
	
	int width = radius / 25;  // 指针宽度	
	// 指针头部，绘制一个三角形
	setcolor(WHITE);
	setfillcolor(WHITE);
	setlinestyle(SOLID_LINE, 0, (int)radius * 0.005);
	ege_line(centerX, centerY + radius / 2 - radius * 0.13 + 10 * scale, centerX - width / 2, centerY + radius / 2 - radius * 0.16 + 10 * scale);
	ege_line(centerX, centerY + radius / 2 - radius * 0.13 + 10 * scale, centerX + width / 2, centerY + radius / 2 - radius * 0.16 + 10 * scale);
	ege_line(centerX - width / 2, centerY + radius / 2 - radius * 0.16 + 10 * scale, centerX + width / 2, centerY + radius / 2 - radius * 0.16 + 10 * scale);
	
	//绘制不动的指示刻度
	drawScale(centerX, centerY, radius);
	
	// 底部文字参数化----------------------------------------------
	setbkmode(TRANSPARENT);  // 透明背景
	setcolor(GREEN);
	LOGFONTW lf;
	ZeroMemory(&lf, sizeof(LOGFONTW));
	lf.lfHeight = radius * 0.05;  // 字体高度参数化
	lf.lfWeight = FW_BOLD;
	lf.lfItalic = FALSE;
	lstrcpyW(lf.lfFaceName, L"微软雅黑");
	setfont(&lf);
	
	outtextxy(centerX + radius * 0.1, centerY - radius * 0.36, "DH     0");
	outtextxy(centerX + radius * 0.21, centerY + radius * 0.32, "0");
	
	setcolor(WHITE);
	outtextxy(centerX + radius * 0.21, centerY - radius * 0.3, "0");
	
	LOGFONTW lf1;
	ZeroMemory(&lf1, sizeof(LOGFONTW));
	lf1.lfHeight = radius * 0.035;  // 字体高度参数化
	lf1.lfWeight = FW_BOLD;
	lf1.lfItalic = FALSE;
	lstrcpyW(lf1.lfFaceName, L"微软雅黑");
	setfont(&lf1);
	
	setcolor(GREEN);
	outtextxy(centerX + radius * 0.065, centerY + radius * 0.50, "MAG");//0.46
	outtextxy(centerX + radius * 0.17, centerY + radius * 0.3, "MCA");
	
	setcolor(WHITE);
	outtextxy(centerX - radius * 0.25, centerY - radius * 0.3, "CME   0");
	outtextxy(centerX - radius * 0.25, centerY + radius * 0.32, "CRS   0");
	outtextxy(centerX + radius * 0.33, centerY + radius * 0.5, "29.92IN");
	
	setcolor(EGERGB(205, 48, 219));
	outtextxy(centerX - radius * 0.12, centerY + radius * 0.50, "ODO");
	
	LOGFONTW lf2;
	ZeroMemory(&lf2, sizeof(LOGFONTW));
	lf2.lfHeight = radius * 0.055;  // 字体高度参数化
	lf2.lfWeight = FW_BOLD;
	lf2.lfItalic = FALSE;
	lstrcpyW(lf2.lfFaceName, L"黑体");
	setfont(&lf2);
	
	setcolor(GREEN);
	outtextxy(centerX + radius * 0.33, centerY + radius * 0.45, "STD");
	
	setcolor(EGERGB(205, 48, 219));
	outtextxy(centerX - radius * 0.4, centerY - radius * 0.37, "200");
	outtextxy(centerX + radius * 0.3, centerY - radius * 0.37, "10000");
}

void drawPointer(int imgwidth, int imglength, int centerX, int centerY, int radius, float angle)// 绘制仪表盘指示三角形
{
	
	int cx = imgwidth / 2;
	int cy = imglength / 2;
	
	setcolor(WHITE);
	setfillcolor(WHITE);
	
	PIMAGE img = newimage(imgwidth, imglength);
	settarget(img);
	setbkcolor(TRANSPARENT);
	cleardevice();
	
	int width = radius / 25;  // 指针宽度    
	// 指针头部，绘制一个三角形
	setcolor(WHITE);
	setfillcolor(WHITE);
	setlinestyle(SOLID_LINE, 0, (int)radius * 0.005);
	ege_line(centerX, centerY - radius / 2 + radius * 0.335, centerX - width / 2, centerY - radius / 2 + radius * 0.365);
	ege_line(centerX, centerY - radius / 2 + radius * 0.335, centerX + width / 2, centerY - radius / 2 + radius * 0.365);
	ege_line(centerX - width / 2, centerY - radius / 2 + radius * 0.365, centerX + width / 2, centerY - radius / 2 + radius * 0.365);
	
	// 旋转绘制 ===================================================
	settarget(NULL);
	putimage_rotatezoom(
		NULL,           // 目标：主屏幕
		img,           // 源图像
		cx, cy,
		0.5, 0.5,     // 旋转中心（图像中心）
		angle,          // 旋转角度（弧度）
		1.0f,           // 缩放比例
		true,           // 透明混合
		-1,             // 不修改透明度
		true            // 抗锯齿
		);
	delimage(img);
}

void drawBar(float centerX, float centerY, float radius)//灰色方块
{
	setfillcolor(EGERGB(28, 28, 31));
	bar(centerX - radius / 2.5 - radius / 25, centerY - radius / 3 + radius / 30, centerX - radius / 3.5, centerY + radius * 0.43);
	bar(centerX + radius / 2.5 + 3 * radius / 50, centerY - radius / 3 + radius / 30, centerX + radius / 3.5 + radius / 50, centerY + radius * 0.43);
	
	//垂直速度表框
	ege_point x_y[] = {
		{centerX + radius / 2.5 + 2 * radius / 25 + radius * 0.015, centerY - radius / 5.5 },
		{centerX + radius / 2.5 + radius / 9 + radius * 0.015, centerY - radius / 5.5 },
		{centerX + radius / 2.5 + radius / 6.5 + radius * 0.015, centerY - radius / 9 },
		{centerX + radius / 2.5 + radius / 6.5 + radius * 0.015, centerY + radius / 9 + radius / 8 },
		{centerX + radius / 2.5 + radius / 9 + radius * 0.015, centerY + radius / 5.5 + radius / 8 },
		{centerX + radius / 2.5 + 2 * radius / 25 + radius * 0.015, centerY + radius / 5.5 + radius / 8 },
		{centerX + radius / 2.5 + 2 * radius / 25 + radius * 0.015, centerY - radius / 5.5 } };
	ege_fillpoly(7, x_y);
	
	//航向指示仪
	
	ege_fillpie(centerX - radius / 3.6, centerY + radius / 2 - radius / 10, radius / 1.8, radius / 2.6, 180, 180);
	
	setfillcolor(EGERGB(5, 5, 5));
	bar(centerX - radius / 3.6, centerY + radius / 2 - radius / 10 + radius / 7, centerX + radius / 3.6, centerY + radius / 2 - radius / 10 + radius / 5.4);
	
}

void drawAltimeter(float centerX, float centerY, float radius, double height)//高度表
{
	
	int hb = (int)height % 1000;
	double j = (0.091 * radius / 100) * hb;
	
	float x1 = centerX + radius / 3.5 + radius / 50;
	float x2 = centerX + radius / 3.5 + radius / 50 + radius / 40;
	
	
	float y1 = centerY - radius / 3 + radius / 30 + j;
	float y2 = y1;
	
	setcolor(WHITE);
	setlinestyle(SOLID_LINE, 0, 1);
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	
	y1 = centerY - radius / 3 + radius / 30 + 0.091 * radius + j;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 + 0.091 * radius * 2 + j;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 + 0.091 * radius * 3 + j;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 + 0.091 * radius * 4 + j;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 + 0.091 * radius * 5 + j;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 + 0.091 * radius * 6 + j;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 + 0.091 * radius * 7 + j;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 + 0.091 * radius * 8 + j;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	
	
	y1 = centerY - radius / 3 + radius / 30 - 0.091 * radius + j;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 - 0.091 * radius * 2 + j;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 - 0.091 * radius * 3 + j;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 - 0.091 * radius * 4 + j;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 - 0.091 * radius * 5 + j;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 - 0.091 * radius * 6 + j;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 - 0.091 * radius * 7 + j;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 - 0.091 * radius * 8 + j;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 - 0.091 * radius * 9 + j;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	
	
	//数字(百位)
	
	hb = (int)height % 1000;
	double h = (0.091 * radius / 100) * hb;
	
	int hq = (int)(height / 100) % 10;
	int M = hq * 100;
	
	double center = centerY - radius / 3 + radius / 30 + 4 * 0.091 * radius - 0.02 * radius;
	
	setcolor(WHITE);
	setbkmode(TRANSPARENT);
	setfont((int)(0.04 * radius), (int)(0.02 * radius), "Bahnschrift");
	
	//数字(千位) 
	int HQW = ((int)height / 1000) % 10;
	double centerq = centerY - radius / 3 + radius / 30 + 4 * 0.091 * radius - 0.03 * radius;
	
	//中心 
	setfont((int)(0.04 * radius), (int)(0.02 * radius), "Bahnschrift");
	double xm = centerX + radius / 2.5 + 3 * radius / 50 - radius * 0.06;
	double ym1 = centerY - radius / 3 + radius / 30 + 4 * 0.091 * radius - 0.02 * radius + h;
	int N = (int)M;
	N = M - (int)((ym1 - center) / (0.091 * radius)) * 100;
	if (N % 200 != 0)
	{
		N = N + 100;
	}
	char str[10];
	sprintf(str, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (N > 0)
			outtextxy(xm, ym1, str);
		else if (N == 0)
			outtextxy(xm, ym1, "000");
		else
			outtextxy(xm - radius * 0.02, ym1, str);
	}
	setfont((int)(0.05 * radius), (int)(0.025 * radius), "Bahnschrift");
	double xq = centerX + radius / 2.5 + 3 * radius / 50 - radius * 0.085;
	double yq1 = centerY - radius / 3 + radius / 30 + 4 * 0.091 * radius - 0.028 * radius + h;
	int HQ = (int)HQW;
	if (N == 800 && yq1 > centerq + 2 * 0.091 * radius)
	{
		HQ--;
	}
	if ((N == 0 && yq1 < centerq) || (N == 200 && yq1 < centerq - 2 * 0.091 * radius))
	{
		HQ++;
	}
	char strq[10];
	sprintf(strq, "%d", HQ);
	if (yq1 >= centerY - radius / 3 + radius / 30 && yq1 <= centerY + radius * 0.43 - 0.06 * radius)
	{
		if (HQW >= 10)
			outtextxy(xq - 0.014 * radius, yq1, strq);
		else if (HQW < 10 && HQW > 0)
			outtextxy(xq, yq1, strq);
	}
	
	//-8
	setfont((int)(0.04 * radius), (int)(0.02 * radius), "Bahnschrift");
	ym1 = centerY - radius / 3 + radius / 30 - 8 * 0.091 * radius - 0.02 * radius + h;
	N = (int)M;
	N = M - (int)((ym1 - center) / (0.091 * radius)) * 100;
	if (N % 200 != 0)
	{
		N = N + 100;
	}
	if (N >= 1000)
	{
		N = 200;
	}
	if (height > 400 && N < 0)
	{
		N = 800;
	}
	char st4[10];
	sprintf(st4, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (N > 0)
			outtextxy(xm, ym1, st4);
		else if (N == 0)
			outtextxy(xm, ym1, "000");
		else
			outtextxy(xm - radius * 0.02, ym1, st4);
	}
	setfont((int)(0.05 * radius), (int)(0.025 * radius), "Bahnschrift");
	yq1 = centerY - radius / 3 + radius / 30 - 8 * 0.091 * radius - 0.028 * radius + h;
	HQ = (int)HQW;
	if (N == 800 && yq1 > centerq + 2 * 0.091 * radius)
	{
		HQ--;
	}
	if ((N == 0 && yq1 < centerq) || (N == 200 && yq1 < centerq - 2 * 0.091 * radius))
	{
		HQ++;
	}
	char strq10[10];
	sprintf(strq10, "%d", HQ);
	if (yq1 >= centerY - radius / 3 + radius / 30 && yq1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (HQ >= 10)
			outtextxy(xq - 0.014 * radius, yq1, strq10);
		else if (HQ < 10 && HQ > 0)
			outtextxy(xq, yq1, strq10);
	}
	
	//-6
	setfont((int)(0.04 * radius), (int)(0.02 * radius), "Bahnschrift");
	ym1 = centerY - radius / 3 + radius / 30 - 6 * 0.091 * radius - 0.02 * radius + h;
	N = (int)M;
	N = M - (int)((ym1 - center) / (0.091 * radius)) * 100;
	if (N % 200 != 0)
	{
		N = N + 100;
	}
	if (N >= 1000)
	{
		N = 0;
	}
	if (height > 400 && N < 0)
	{
		N = 800;
	}
	char st3[10];
	sprintf(st3, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (N > 0)
			outtextxy(xm, ym1, st3);
		else if (N == 0)
			outtextxy(xm, ym1, "000");
		else
			outtextxy(xm - radius * 0.02, ym1, st3);
	}
	setfont((int)(0.05 * radius), (int)(0.025 * radius), "Bahnschrift");
	yq1 = centerY - radius / 3 + radius / 30 - 6 * 0.091 * radius - 0.028 * radius + h;
	HQ = (int)HQW;
	if (N == 800 && yq1 > centerq + 2 * 0.091 * radius)
	{
		HQ--;
	}
	if ((N == 0 && yq1 < centerq) || (N == 200 && yq1 < centerq - 2 * 0.091 * radius))
	{
		HQ++;
	}
	char strq5[10];
	sprintf(strq5, "%d", HQ);
	if (yq1 >= centerY - radius / 3 + radius / 30 && yq1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (HQ >= 10)
			outtextxy(xq - 0.014 * radius, yq1, strq5);
		else if (HQ < 10 && HQ > 0)
			outtextxy(xq, yq1, strq5);
	}
	
	//-4
	setfont((int)(0.04 * radius), (int)(0.02 * radius), "Bahnschrift");
	ym1 = centerY - radius / 3 + radius / 30 - 4 * 0.091 * radius - 0.02 * radius + h;
	N = (int)M;
	N = M - (int)((ym1 - center) / (0.091 * radius)) * 100;
	if (N % 200 != 0)
	{
		N = N + 100;
	}
	if (height > 400 && N < 0)
	{
		N = 800;
	}
	char st2[10];
	sprintf(st2, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (N > 0)
			outtextxy(xm, ym1, st2);
		else if (N == 0)
			outtextxy(xm, ym1, "000");
		else
			outtextxy(xm - radius * 0.02, ym1, st2);
	}
	setfont((int)(0.05 * radius), (int)(0.025 * radius), "Bahnschrift");
	yq1 = centerY - radius / 3 + radius / 30 - 4 * 0.091 * radius - 0.028 * radius + h;
	HQ = (int)HQW;
	if (N == 800 && yq1 > centerq + 2 * 0.091 * radius)
	{
		HQ--;
	}
	if ((N == 0 && yq1 < centerq) || (N == 200 && yq1 < centerq - 2 * 0.091 * radius))
	{
		HQ++;
	}
	char strq4[10];
	sprintf(strq4, "%d", HQ);
	if (yq1 >= centerY - radius / 3 + radius / 30 && yq1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (HQ >= 10)
			outtextxy(xq - 0.014 * radius, yq1, strq4);
		else if (HQ < 10 && HQ > 0)
			outtextxy(xq, yq1, strq4);
	}
	
	//-2
	setfont((int)(0.04 * radius), (int)(0.02 * radius), "Bahnschrift");
	ym1 = centerY - radius / 3 + radius / 30 - 2 * 0.091 * radius - 0.02 * radius + h;
	N = (int)M;
	N = M - (int)((ym1 - center) / (0.091 * radius)) * 100;
	if (N % 200 != 0)
	{
		N = N + 100;
	}
	if (height > 400 && N < 0)
	{
		N = 800;
	}
	char st1[10];
	sprintf(st1, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (N > 0)
			outtextxy(xm, ym1, st1);
		else if (N == 0)
			outtextxy(xm, ym1, "000");
		else
			outtextxy(xm - radius * 0.02, ym1, st1);
	}
	setfont((int)(0.05 * radius), (int)(0.025 * radius), "Bahnschrift");
	yq1 = centerY - radius / 3 + radius / 30 - 2 * 0.091 * radius - 0.028 * radius + h;
	HQ = (int)HQW;
	if (N == 800 && yq1 > centerq + 2 * 0.091 * radius)
	{
		HQ--;
	}
	if ((N == 0 && yq1 < centerq) || (N == 200 && yq1 < centerq - 2 * 0.091 * radius))
	{
		HQ++;
	}
	char strq3[10];
	sprintf(strq3, "%d", HQ);
	if (yq1 >= centerY - radius / 3 + radius / 30 && yq1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (HQ >= 10)
			outtextxy(xq - 0.014 * radius, yq1, strq3);
		else if (HQ < 10 && HQ > 0)
			outtextxy(xq, yq1, strq3);
	}
	
	//+2
	setfont((int)(0.04 * radius), (int)(0.02 * radius), "Bahnschrift");
	ym1 = centerY - radius / 3 + radius / 30 + 2 * 0.091 * radius - 0.02 * radius + h;
	N = (int)M;
	N = M - (int)((ym1 - center) / (0.091 * radius)) * 100;
	if (N % 200 != 0)
	{
		N = N + 100;
	}
	if (height > 400 && N < 0)
	{
		N = 800;
	}
	char str1[10];
	sprintf(str1, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (N > 0)
			outtextxy(xm, ym1, str1);
		else if (N == 0)
			outtextxy(xm, ym1, "000");
		else
			outtextxy(xm - radius * 0.02, ym1, str1);
	}
	setfont((int)(0.05 * radius), (int)(0.025 * radius), "Bahnschrift");
	yq1 = centerY - radius / 3 + radius / 30 + 2 * 0.091 * radius - 0.028 * radius + h;
	HQ = (int)HQW;
	if (N == 800 && yq1 > centerq + 2 * 0.091 * radius)
	{
		HQ--;
	}
	if ((N == 0 && yq1 < centerq) || (N == 200 && yq1 < centerq - 2 * 0.091 * radius))
	{
		HQ++;
	}
	char strq1[10];
	sprintf(strq1, "%d", HQ);
	if (yq1 >= centerY - radius / 3 + radius / 30 && yq1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (HQ >= 10)
			outtextxy(xq - 0.014 * radius, yq1, strq1);
		else if (HQ < 10 && HQ > 0)
			outtextxy(xq, yq1, strq1);
	}
	
	//0
	setfont((int)(0.04 * radius), (int)(0.02 * radius), "Bahnschrift");
	ym1 = centerY - radius / 3 + radius / 30 - 0.02 * radius + h;
	N = (int)M;
	N = M - (int)((ym1 - center) / (0.091 * radius)) * 100;
	if (N % 200 != 0)
	{
		N = N + 100;
	}
	if (height > 400 && N < 0)
	{
		N = 800;
	}
	char str2[10];
	sprintf(str2, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (N > 0)
			outtextxy(xm, ym1, str2);
		else if (N == 0)
			outtextxy(xm, ym1, "000");
		else
			outtextxy(xm - radius * 0.02, ym1, str2);
	}
	setfont((int)(0.05 * radius), (int)(0.025 * radius), "Bahnschrift");
	yq1 = centerY - radius / 3 + radius / 30 - 0.028 * radius + h;
	HQ = (int)HQW;
	if (N == 800 && yq1 > centerq + 2 * 0.091 * radius)
	{
		HQ--;
	}
	if ((N == 0 && yq1 < centerq) || (N == 200 && yq1 < centerq - 2 * 0.091 * radius))
	{
		HQ++;
	}
	char strq2[10];
	sprintf(strq2, "%d", HQ);
	if (N == 000 || N == 200)
	{
		if (yq1 < centerq && height > 1000)
			HQ++;
	}
	if (yq1 >= centerY - radius / 3 + radius / 30 && yq1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (HQ >= 10)
			outtextxy(xq - 0.014 * radius, yq1, strq2);
		else if (HQ < 10 && HQ > 0)
			outtextxy(xq, yq1, strq2);
	}
	
	//+6
	setfont((int)(0.04 * radius), (int)(0.02 * radius), "Bahnschrift");
	ym1 = centerY - radius / 3 + radius / 30 + 6 * 0.091 * radius - 0.02 * radius + h;
	N = (int)M;
	N = M - (int)((ym1 - center) / (0.091 * radius)) * 100;
	if (N % 200 != 0)
	{
		N = N + 100;
	}
	if (height > 400 && N < 0)
	{
		N = 800;
	}
	char str3[10];
	sprintf(str3, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (N > 0)
			outtextxy(xm, ym1, str3);
		else if (N == 0)
			outtextxy(xm, ym1, "000");
		else
			outtextxy(xm - radius * 0.02, ym1, str3);
	}
	setfont((int)(0.05 * radius), (int)(0.025 * radius), "Bahnschrift");
	yq1 = centerY - radius / 3 + radius / 30 + 6 * 0.091 * radius - 0.028 * radius + h;
	HQ = (int)HQW;
	if (N == 800 && yq1 > centerq + 2 * 0.091 * radius)
	{
		HQ--;
	}
	if ((N == 0 && yq1 < centerq) || (N == 200 && yq1 < centerq - 2 * 0.091 * radius))
	{
		HQ++;
	}
	char strq6[10];
	sprintf(strq6, "%d", HQ);
	if (yq1 >= centerY - radius / 3 + radius / 30 && yq1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (HQ >= 10)
			outtextxy(xq - 0.014 * radius, yq1, strq6);
		else if (HQ < 10 && HQ > 0)
			outtextxy(xq, yq1, strq6);
	}
	
	//+8
	setfont((int)(0.04 * radius), (int)(0.02 * radius), "Bahnschrift");
	ym1 = centerY - radius / 3 + radius / 30 + 8 * 0.091 * radius - 0.02 * radius + h;
	N = (int)M;
	N = M - (int)((ym1 - center) / (0.091 * radius)) * 100;
	if (N % 200 != 0)
	{
		N = N + 100;
	}
	if (height > 400 && N < 0)
	{
		N = 800;
	}
	char str4[10];
	sprintf(str4, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (N > 0)
			outtextxy(xm, ym1, str4);
		else if (N == 0)
			outtextxy(xm, ym1, "000");
		else
			outtextxy(xm - radius * 0.02, ym1, str4);
	}
	setfont((int)(0.05 * radius), (int)(0.025 * radius), "Bahnschrift");
	yq1 = centerY - radius / 3 + radius / 30 + 8 * 0.091 * radius - 0.028 * radius + h;
	HQ = (int)HQW;
	if (N == 800 && yq1 > centerq + 2 * 0.091 * radius)
	{
		HQ--;
	}
	if ((N == 0 && yq1 < centerq) || (N == 200 && yq1 < centerq - 2 * 0.091 * radius))
	{
		HQ++;
	}
	char strq7[10];
	sprintf(strq7, "%d", HQ);
	if (yq1 >= centerY - radius / 3 + radius / 30 && yq1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (HQ >= 10)
			outtextxy(xq - 0.014 * radius, yq1, strq7);
		else if (HQ < 10 && HQ > 0)
			outtextxy(xq, yq1, strq7);
	}
	
	//+10
	setfont((int)(0.04 * radius), (int)(0.02 * radius), "Bahnschrift");
	ym1 = centerY - radius / 3 + radius / 30 + 10 * 0.091 * radius - 0.02 * radius + h;
	N = (int)M;
	N = M - (int)((ym1 - center) / (0.091 * radius)) * 100;
	if (N % 200 != 0)
	{
		N = N + 100;
	}
	if (height > 400 && N < 0)
	{
		N = 800;
	}
	char str5[10];
	sprintf(str5, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (N > 0)
			outtextxy(xm, ym1, str5);
		else if (N == 0)
			outtextxy(xm, ym1, "000");
		else
			outtextxy(xm - radius * 0.02, ym1, str5);
	}
	setfont((int)(0.05 * radius), (int)(0.025 * radius), "Bahnschrift");
	yq1 = centerY - radius / 3 + radius / 30 + 10 * 0.091 * radius - 0.028 * radius + h;
	HQ = (int)HQW;
	if (N == 800 && yq1 > centerq + 2 * 0.091 * radius)
	{
		HQ--;
	}
	if ((N == 0 && yq1 < centerq) || (N == 200 && yq1 < centerq - 2 * 0.091 * radius))
	{
		HQ++;
	}
	char strq8[10];
	sprintf(strq8, "%d", HQ);
	if (yq1 >= centerY - radius / 3 + radius / 30 && yq1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (HQ >= 10)
			outtextxy(xq - 0.014 * radius, yq1, strq8);
		else if (HQ < 10 && HQ > 0)
			outtextxy(xq, yq1, strq8);
	}
	
	//000指示标
	if (height >= -400 && height <= 400)
	{
		hb = (int)height % 1000;
		double z = (0.091 * radius / 100) * hb;
		setcolor(GREEN);
		setlinestyle(SOLID_LINE, 0, 2);
		ege_line(centerX + radius / 3.5 + radius / 50 - radius / 200, centerY + radius / 30 - radius / 3 + 4 * 0.091 * radius + z,
			centerX + radius / 2.5 + 3 * radius / 50, centerY - radius / 3 + radius / 30 + 4 * 0.09 * radius + z);
		
		ege_point x_y[] = {
			{centerX + radius / 3.5 + radius / 50 - radius / 200, centerY - radius / 3 + 4 * 0.091 * radius + radius / 30 + z}  ,
			{centerX + radius / 3.5 + radius / 50 - radius / 39, centerY - radius / 3 + 4 * 0.091 * radius + z} ,
			{centerX + radius / 3.5 + radius / 50 - radius / 39, centerY - radius / 3 + 4 * 0.091 * radius + radius / 15 + z} ,
			{centerX + radius / 3.5 + radius / 50 - radius / 200, centerY - radius / 3 + 4 * 0.091 * radius + radius / 30 + z}
		};
		ege_drawpoly(4, x_y);
	}
}

void drawAirspeed(float centerX, float centerY, float radius, double speed)
{
	int s = (int)speed % 100;
	double i = -(0.066 * radius / 10) * s;
	
	float x1 = centerX - radius / 3.5;
	float y1 = centerY - radius / 3 + radius / 30 - i;
	float x2 = centerX - radius / 3.5 - radius / 40;
	float y2 = y1;
	
	setcolor(WHITE);
	setlinestyle(SOLID_LINE, 0, 1);
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	
	
	y1 = centerY - radius / 3 + radius / 30 - 1 * 0.066 * radius - i;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 - 2 * 0.066 * radius - i;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 - 3 * 0.066 * radius - i;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 - 4 * 0.066 * radius - i;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 - 5 * 0.066 * radius - i;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 - 6 * 0.066 * radius - i;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 - 7 * 0.066 * radius - i;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 - 8 * 0.066 * radius - i;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 - 9 * 0.066 * radius - i;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 - 10 * 0.066 * radius - i;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 - 11 * 0.066 * radius - i;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 - 12 * 0.066 * radius - i;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 - 13 * 0.066 * radius;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 - 14 * 0.066 * radius - i;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 - 15 * 0.066 * radius - i;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 - 16 * 0.066 * radius - i;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	
	
	y1 = centerY - radius / 3 + radius / 30 + 1 * 0.066 * radius - i;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 + 2 * 0.066 * radius - i;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 + 3 * 0.066 * radius - i;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	y1 = centerY - radius / 3 + radius / 30 + 4 * 0.066 * radius - i;
	y2 = y1;
	if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
		ege_line(x1, y1, x2, y2);
	if (speed >= 100)
	{
		y1 = centerY - radius / 3 + radius / 30 + 5 * 0.066 * radius - i;
		y2 = y1;
		if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
			ege_line(x1, y1, x2, y2);
		y1 = centerY - radius / 3 + radius / 30 + 6 * 0.066 * radius - i;
		y2 = y1;
		if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
			ege_line(x1, y1, x2, y2);
		y1 = centerY - radius / 3 + radius / 30 + 7 * 0.066 * radius - i;
		y2 = y1;
		if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
			ege_line(x1, y1, x2, y2);
		y1 = centerY - radius / 3 + radius / 30 + 8 * 0.066 * radius - i;
		y2 = y1;
		if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
			ege_line(x1, y1, x2, y2);
		y1 = centerY - radius / 3 + radius / 30 + 9 * 0.066 * radius - i;
		y2 = y1;
		if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
			ege_line(x1, y1, x2, y2);
		y1 = centerY - radius / 3 + radius / 30 + 10 * 0.066 * radius - i;
		y2 = y1;
		if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
			ege_line(x1, y1, x2, y2);
		y1 = centerY - radius / 3 + radius / 30 + 11 * 0.066 * radius - i;
		y2 = y1;
		if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
			ege_line(x1, y1, x2, y2);
		y1 = centerY - radius / 3 + radius / 30 + 12 * 0.066 * radius - i;
		y2 = y1;
		if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
			ege_line(x1, y1, x2, y2);
		y1 = centerY - radius / 3 + radius / 30 + 13 * 0.066 * radius - i;
		y2 = y1;
		if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
			ege_line(x1, y1, x2, y2);
		y1 = centerY - radius / 3 + radius / 30 + 14 * 0.066 * radius - i;
		y2 = y1;
		if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
			ege_line(x1, y1, x2, y2);
		y1 = centerY - radius / 3 + radius / 30 + 15 * 0.066 * radius - i;
		y2 = y1;
		if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
			ege_line(x1, y1, x2, y2);
		y1 = centerY - radius / 3 + radius / 30 + 16 * 0.066 * radius - i;
		y2 = y1;
		if (y1 >= centerY - radius / 3 + radius / 30 && y1 <= centerY + radius * 0.43)
			ege_line(x1, y1, x2, y2);
	}
	
}

void SpeedMember(float centerX, float centerY, float radius, double speed)
{
	int s = (int)speed % 1000;
	double i = (0.066 * radius / 10) * s;
	int M = (int)s / 10;
	
	double center = centerY - radius / 3 + radius / 30 + 6 * 0.066 * radius - 0.025 * radius;
	//centerX - radius / 3.5 - 0.045 * radius , centerY - radius / 3 + 0.43 * radius - 0.025 * radius
	setcolor(WHITE);
	setbkmode(TRANSPARENT);
	setfont((int)(0.05 * radius), (int)(0.025 * radius), "Bahnschrift");
	
	double xm = centerX - radius / 3.5 - radius / 20 - radius * 0.05;
	double ym1 = centerY - radius / 3 + radius / 30 + 6 * 0.066 * radius - 0.025 * radius + i;
	
	int N = (int)M * 10;
	N = N - (int)((ym1 - center) / (0.066 * radius)) * 10;
	if (N < 0)
	{
		N = 100 + N;
	}
	if (N % 20 != 0)
	{
		N = (N / 10 + 1) * 10;
	}
	char str[10];
	sprintf(str, "%d", N);
	if (speed > 100)
		if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
		{
			if (ym1 <= centerY - radius / 3 + 0.43 * radius - 0.1 * radius || ym1 >= centerY - radius / 3 + 0.43 * radius + 0.05 * radius)
				outtextxy(xm, ym1, str);
		}
	
	xm = centerX - radius / 3.5 - radius / 20 - radius * 0.05;
	ym1 = centerY - radius / 3 + radius / 30 + 4 * 0.066 * radius - 0.025 * radius + i;
	N = (int)M * 10;
	N = N - (int)((ym1 - center) / (0.066 * radius)) * 10;
	if (N < 0)
	{
		N = 100 + N;
	}
	if (N % 20 != 0)
	{
		N = (N / 10 + 1) * 10;
	}
	char str6[10];
	sprintf(str6, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (ym1 <= centerY - radius / 3 + 0.43 * radius - 0.1 * radius || ym1 >= centerY - radius / 3 + 0.43 * radius + 0.05 * radius)
			outtextxy(xm, ym1, str6);
	}
	
	xm = centerX - radius / 3.5 - radius / 20 - radius * 0.05;
	ym1 = centerY - radius / 3 + radius / 30 + 2 * 0.066 * radius - 0.025 * radius + i;
	N = (int)M * 10;
	N = N - (int)((ym1 - center) / (0.066 * radius)) * 10;
	if (N < 0)
	{
		N = 100 + N;
	}
	if (N % 20 != 0)
	{
		N = (N / 10 + 1) * 10;
	}
	char str7[10];
	sprintf(str7, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (ym1 <= centerY - radius / 3 + 0.43 * radius - 0.1 * radius || ym1 >= centerY - radius / 3 + 0.43 * radius + 0.05 * radius)
			outtextxy(xm, ym1, str7);
	}
	
	xm = centerX - radius / 3.5 - radius / 20 - radius * 0.05;
	ym1 = centerY - radius / 3 + radius / 30 - 0.025 * radius + i;
	N = (int)M * 10;
	N = N - (int)((ym1 - center) / (0.066 * radius)) * 10;
	if (N < 0)
	{
		N = 100 + N;
	}
	if (N % 20 != 0)
	{
		N = (N / 10 + 1) * 10;
	}
	char str8[10];
	sprintf(str8, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (ym1 <= centerY - radius / 3 + 0.43 * radius - 0.1 * radius || ym1 >= centerY - radius / 3 + 0.43 * radius + 0.05 * radius)
			outtextxy(xm, ym1, str8);
	}
	
	xm = centerX - radius / 3.5 - radius / 20 - radius * 0.05;
	ym1 = centerY - radius / 3 + radius / 30 - 2 * 0.066 * radius - 0.025 * radius + i;
	N = (int)M * 10;
	N = N - (int)((ym1 - center) / (0.066 * radius)) * 10;
	if (N < 0)
	{
		N = 100 + N;
	}
	if (N % 20 != 0)
	{
		N = (N / 10 + 1) * 10;
	}
	char str9[10];
	sprintf(str9, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (ym1 <= centerY - radius / 3 + 0.43 * radius - 0.1 * radius || ym1 >= centerY - radius / 3 + 0.43 * radius + 0.05 * radius)
			outtextxy(xm, ym1, str9);
	}
	
	xm = centerX - radius / 3.5 - radius / 20 - radius * 0.05;
	ym1 = centerY - radius / 3 + radius / 30 - 4 * 0.066 * radius - 0.025 * radius + i;
	N = (int)M * 10;
	N = N - (int)((ym1 - center) / (0.066 * radius)) * 10;
	if (N < 0)
	{
		N = 100 + N;
	}
	if (N % 20 != 0)
	{
		N = (N / 10 + 1) * 10;
	}
	char str10[10];
	sprintf(str10, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (ym1 <= centerY - radius / 3 + 0.43 * radius - 0.1 * radius || ym1 >= centerY - radius / 3 + 0.43 * radius + 0.05 * radius)
			outtextxy(xm, ym1, str10);
	}
	
	xm = centerX - radius / 3.5 - radius / 20 - radius * 0.05;
	ym1 = centerY - radius / 3 + radius / 30 - 6 * 0.066 * radius - 0.025 * radius + i;
	N = (int)M * 10;
	N = N - (int)((ym1 - center) / (0.066 * radius)) * 10;
	if (N < 0)
	{
		N = 100 + N;
	}
	if (N % 20 != 0)
	{
		N = (N / 10 + 1) * 10;
	}
	char str11[10];
	sprintf(str11, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (ym1 <= centerY - radius / 3 + 0.43 * radius - 0.1 * radius || ym1 >= centerY - radius / 3 + 0.43 * radius + 0.05 * radius)
			outtextxy(xm, ym1, str11);
	}
	
	xm = centerX - radius / 3.5 - radius / 20 - radius * 0.05;
	ym1 = centerY - radius / 3 + radius / 30 - 8 * 0.066 * radius - 0.025 * radius + i;
	N = (int)M * 10;
	N = N - (int)((ym1 - center) / (0.066 * radius)) * 10;
	if (N < 0)
	{
		N = 100 + N;
	}
	if (N % 20 != 0)
	{
		N = (N / 10 + 1) * 10;
	}
	char str12[10];
	sprintf(str12, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (ym1 <= centerY - radius / 3 + 0.43 * radius - 0.1 * radius || ym1 >= centerY - radius / 3 + 0.43 * radius + 0.05 * radius)
			outtextxy(xm, ym1, str12);
	}
	
	xm = centerX - radius / 3.5 - radius / 20 - radius * 0.05;
	ym1 = centerY - radius / 3 + radius / 30 - 10 * 0.066 * radius - 0.025 * radius + i;
	N = (int)M * 10;
	N = N - (int)((ym1 - center) / (0.066 * radius)) * 10;
	if (N < 0)
	{
		N = 100 + N;
	}
	if (N % 20 != 0)
	{
		N = (N / 10 + 1) * 10;
	}
	char str13[10];
	sprintf(str13, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (ym1 <= centerY - radius / 3 + 0.43 * radius - 0.1 * radius || ym1 >= centerY - radius / 3 + 0.43 * radius + 0.05 * radius)
			outtextxy(xm, ym1, str13);
	}
	
	xm = centerX - radius / 3.5 - radius / 20 - radius * 0.05;
	ym1 = centerY - radius / 3 + radius / 30 - 12 * 0.066 * radius - 0.025 * radius + i;
	N = (int)M * 10;
	N = N - (int)((ym1 - center) / (0.066 * radius)) * 10;
	if (N < 0)
	{
		N = 100 + N;
	}
	if (N % 20 != 0)
	{
		N = (N / 10 + 1) * 10;
	}
	char str14[10];
	sprintf(str14, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (ym1 <= centerY - radius / 3 + 0.43 * radius - 0.1 * radius || ym1 >= centerY - radius / 3 + 0.43 * radius + 0.05 * radius)
			outtextxy(xm, ym1, str14);
	}
	
	xm = centerX - radius / 3.5 - radius / 20 - radius * 0.05;
	ym1 = centerY - radius / 3 + radius / 30 - 14 * 0.066 * radius - 0.025 * radius + i;
	N = (int)M * 10;
	N = N - (int)((ym1 - center) / (0.066 * radius)) * 10;
	if (N < 0)
	{
		N = 100 + N;
	}
	if (N % 20 != 0)
	{
		N = (N / 10 + 1) * 10;
	}
	char str15[10];
	sprintf(str15, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (ym1 <= centerY - radius / 3 + 0.43 * radius - 0.1 * radius || ym1 >= centerY - radius / 3 + 0.43 * radius + 0.05 * radius)
			outtextxy(xm, ym1, str15);
	}
	
	xm = centerX - radius / 3.5 - radius / 20 - radius * 0.05;
	ym1 = centerY - radius / 3 + radius / 30 - 16 * 0.066 * radius - 0.025 * radius + i;
	N = (int)M * 10;
	N = N - (int)((ym1 - center) / (0.066 * radius)) * 10;
	if (N < 0)
	{
		N = 100 + N;
	}
	if (N % 20 != 0)
	{
		N = (N / 10 + 1) * 10;
	}
	char str16[10];
	sprintf(str16, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (ym1 <= centerY - radius / 3 + 0.43 * radius - 0.1 * radius || ym1 >= centerY - radius / 3 + 0.43 * radius + 0.05 * radius)
			outtextxy(xm, ym1, str16);
	}
	
	xm = centerX - radius / 3.5 - radius / 20 - radius * 0.05;
	ym1 = centerY - radius / 3 + radius / 30 - 18 * 0.066 * radius - 0.025 * radius + i;
	N = (int)M * 10;
	N = N - (int)((ym1 - center) / (0.066 * radius)) * 10;
	if (N < 0)
	{
		N = 100 + N;
	}
	if (N % 20 != 0)
	{
		N = (N / 10 + 1) * 10;
	}
	char str17[10];
	sprintf(str17, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (ym1 <= centerY - radius / 3 + 0.43 * radius - 0.1 * radius || ym1 >= centerY - radius / 3 + 0.43 * radius + 0.05 * radius)
			outtextxy(xm, ym1, str17);
	}
	
	xm = centerX - radius / 3.5 - radius / 20 - radius * 0.05;
	ym1 = centerY - radius / 3 + radius / 30 - 20 * 0.066 * radius - 0.025 * radius + i;
	N = (int)M * 10;
	N = N - (int)((ym1 - center) / (0.066 * radius)) * 10;
	if (N < 0)
	{
		N = 100 + N;
	}
	if (N % 20 != 0)
	{
		N = (N / 10 + 1) * 10;
	}
	char str18[10];
	sprintf(str18, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (ym1 <= centerY - radius / 3 + 0.43 * radius - 0.1 * radius || ym1 >= centerY - radius / 3 + 0.43 * radius + 0.05 * radius)
			outtextxy(xm, ym1, str18);
	}
	
	xm = centerX - radius / 3.5 - radius / 20 - radius * 0.05;
	ym1 = centerY - radius / 3 + radius / 30 - 22 * 0.066 * radius - 0.025 * radius + i;
	N = (int)M * 10;
	N = N - (int)((ym1 - center) / (0.066 * radius)) * 10;
	if (N < 0)
	{
		N = 100 + N;
	}
	if (N % 20 != 0)
	{
		N = (N / 10 + 1) * 10;
	}
	char str19[10];
	sprintf(str19, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (ym1 <= centerY - radius / 3 + 0.43 * radius - 0.1 * radius || ym1 >= centerY - radius / 3 + 0.43 * radius + 0.05 * radius)
			outtextxy(xm, ym1, str19);
	}
	
	xm = centerX - radius / 3.5 - radius / 20 - radius * 0.05;
	ym1 = centerY - radius / 3 + radius / 30 - 24 * 0.066 * radius - 0.025 * radius + i;
	N = (int)M * 10;
	N = N - (int)((ym1 - center) / (0.066 * radius)) * 10;
	if (N < 0)
	{
		N = 100 + N;
	}
	if (N % 20 != 0)
	{
		N = (N / 10 + 1) * 10;
	}
	char str20[10];
	sprintf(str20, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (ym1 <= centerY - radius / 3 + 0.43 * radius - 0.1 * radius || ym1 >= centerY - radius / 3 + 0.43 * radius + 0.05 * radius)
			outtextxy(xm, ym1, str20);
	}
	
	xm = centerX - radius / 3.5 - radius / 20 - radius * 0.05;
	ym1 = centerY - radius / 3 + radius / 30 - 26 * 0.066 * radius - 0.025 * radius + i;
	N = (int)M * 10;
	N = N - (int)((ym1 - center) / (0.066 * radius)) * 10;
	if (N < 0)
	{
		N = 100 + N;
	}
	if (N % 20 != 0)
	{
		N = (N / 10 + 1) * 10;
	}
	char str21[10];
	sprintf(str21, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (ym1 <= centerY - radius / 3 + 0.43 * radius - 0.1 * radius || ym1 >= centerY - radius / 3 + 0.43 * radius + 0.05 * radius)
			outtextxy(xm, ym1, str21);
	}
	
	xm = centerX - radius / 3.5 - radius / 20 - radius * 0.05;
	ym1 = centerY - radius / 3 + radius / 30 - 28 * 0.066 * radius - 0.025 * radius + i;
	N = (int)M * 10;
	N = N - (int)((ym1 - center) / (0.066 * radius)) * 10;
	if (N < 0)
	{
		N = 100 + N;
	}
	if (N % 20 != 0)
	{
		N = (N / 10 + 1) * 10;
	}
	char str22[10];
	sprintf(str22, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (ym1 <= centerY - radius / 3 + 0.43 * radius - 0.1 * radius || ym1 >= centerY - radius / 3 + 0.43 * radius + 0.05 * radius)
			outtextxy(xm, ym1, str22);
	}
	
	xm = centerX - radius / 3.5 - radius / 20 - radius * 0.05;
	ym1 = centerY - radius / 3 + radius / 30 - 30 * 0.066 * radius - 0.025 * radius + i;
	N = (int)M * 10;
	N = N - (int)((ym1 - center) / (0.066 * radius)) * 10;
	if (N < 0)
	{
		N = 100 + N;
	}
	if (N % 20 != 0)
	{
		N = (N / 10 + 1) * 10;
	}
	char str23[10];
	sprintf(str23, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (ym1 <= centerY - radius / 3 + 0.43 * radius - 0.1 * radius || ym1 >= centerY - radius / 3 + 0.43 * radius + 0.05 * radius)
			outtextxy(xm, ym1, str23);
	}
	
	xm = centerX - radius / 3.5 - radius / 20 - radius * 0.05;
	ym1 = centerY - radius / 3 + radius / 30 - 32 * 0.066 * radius - 0.025 * radius + i;
	N = (int)M * 10;
	N = N - (int)((ym1 - center) / (0.066 * radius)) * 10;
	if (N < 0)
	{
		N = 100 + N;
	}
	if (N % 20 != 0)
	{
		N = (N / 10 + 1) * 10;
	}
	char str24[10];
	sprintf(str24, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (ym1 <= centerY - radius / 3 + 0.43 * radius - 0.1 * radius || ym1 >= centerY - radius / 3 + 0.43 * radius + 0.05 * radius)
			outtextxy(xm, ym1, str24);
	}
	
	xm = centerX - radius / 3.5 - radius / 20 - radius * 0.05;
	ym1 = centerY - radius / 3 + radius / 30 - 34 * 0.066 * radius - 0.025 * radius + i;
	N = (int)M * 10;
	N = N - (int)((ym1 - center) / (0.066 * radius)) * 10;
	if (N < 0)
	{
		N = 100 + N;
	}
	if (N % 20 != 0)
	{
		N = (N / 10 + 1) * 10;
	}
	char str25[10];
	sprintf(str25, "%d", N);
	if (ym1 >= centerY - radius / 3 + radius / 30 && ym1 <= centerY + radius * 0.43 - 0.04 * radius)
	{
		if (ym1 <= centerY - radius / 3 + 0.43 * radius - 0.1 * radius || ym1 >= centerY - radius / 3 + 0.43 * radius + 0.05 * radius)
			outtextxy(xm, ym1, str25);
	}
}

void drawHeadingIndicator(int width, int height, float centerX, float centerY, float radius, float rotationAngle) 
{
	// 创建临时图像
	PIMAGE imgBuffer = newimage(width, height);
	
	// 计算临时图像中心坐标
	const float imgCenterX = width / 2.0f;
	const float imgCenterY = height / 2.0f;
	
	// 设置绘图目标为临时图像
	PIMAGE oldTarget = gettarget();
	settarget(imgBuffer);
	setbkcolor(TRANSPARENT);
	cleardevice(0);  // 透明背景
	
	// 数字标签（每30度一个数字）
	char num[12][3] = {"3","6","9","12","15","18","21","24","27","30","33","36"};
	float radius1 = radius / 3.6f;    // 小圆的半径
	float textRadius = radius1 * 0.95f; // 文字位置半径（稍向内）
	
	// 绘制数字标签（与刻度平行）
	for (int i = 0; i < 12; i++) 
	{
		float angle = i * 30.0f;  // 每个数字间隔30度
		float rad = angle * PI / 180.0f;
		
		// 计算文字位置（考虑旋转角度）
		float textX = imgCenterX + textRadius * cos(rad);
		float textY = imgCenterY - textRadius * sin(rad);
		
		// 设置字体（大小与半径成比例）
		LOGFONTW font;
		lstrcpyW(font.lfFaceName, L"Arial");
		font.lfHeight = radius * 0.03f;
		font.lfWeight = FW_NORMAL;
		font.lfWidth = 0;
		font.lfItalic = false;
		
		// 关键修改：文字旋转角度与刻度方向一致
		// 角度转换为0.1度单位（Escapement需要）
		font.lfEscapement = (int)(angle * 10.0f) - 900; 
		font.lfOrientation = (int)(angle * 10.0f) - 900;
		setfont(&font);
		
		// 计算文字居中偏移（基于文字宽度）
		int textWidth = textwidth(num[i]);
		int textHeight = textheight(num[i]);
		textX -= textWidth / 2.0f * cos(rad);
		textY += textWidth / 2.0f * sin(rad);
		
		setcolor(WHITE);
		outtextxy((int)textX, (int)textY, num[i]);
	}
	
	// 绘制刻度线（72个刻度，每5度一个）
	for (int i = 0; i < 72; i++) 
	{
		float angle = i * 5.0f;
		float rad = angle * PI / 180.0f;
		float len = (i % 3 == 1) ? radius * 0.015f : radius * 0.01f;
		
		setlinestyle(SOLID_LINE, 0, (int)(radius/200.0f));
		setcolor(WHITE);
		
		ege_line(
			imgCenterX + (radius1 - len) * cos(rad),
			imgCenterY - (radius1 - len) * sin(rad),
			imgCenterX + radius1 * cos(rad),
			imgCenterY - radius1 * sin(rad)
			);
	}
	
	// 恢复原始绘图目标
	settarget(oldTarget);
	
	// 旋转并绘制到屏幕
	putimage_rotatezoom(
		NULL,               // 目标图像（NULL表示屏幕）
		imgBuffer,          // 源图像
		centerX,            // 目标位置X
		centerY + radius / 2 - radius / 10 + radius / 3.6, // 目标位置Y
		0.5f, 0.5f,         // 旋转中心（图像中心，归一化坐标）
		rotationAngle,      // 旋转角度（弧度）
		1.0f,              // 缩放比例
		true,              // 透明通道
		-1,                // 不设置透明度
		true               // 平滑缩放
		);
	
	// 释放临时图像
	delimage(imgBuffer);
	
	setfillcolor(EGERGB(180,180,180));
	ege_fillrect(centerX-radius/2,centerY+radius/1.5,radius,radius/3);
}

void drawVerticalSpeed(float centerX, float centerY, float radius, double verticalSpeed)
{
	for (int i = 0; i < 13; i++)
	{
		int flag = 0;
		
		float x1;
		if ((i + 1) % 2 != 0)
			x1 = centerX + radius / 2.5 + radius / 10 + radius * 0.015;
		else
		{
			x1 = centerX + radius / 2.5 + radius / 9.6 + radius * 0.015;
			flag = 1;
		}
		
		float y1;
		
		if (i <= 2)
		{
			y1 = centerY - radius / 5.5 + radius / 70 + i * (0.0235) * radius;
		}
		else if (i < 5)
		{
			y1 = centerY - radius / 5.5 + radius / 70 + 2 * (0.0235) * radius + (i - 2) * (0.04) * radius;
		}
		else if (i <= 8)
		{
			y1 = centerY - radius / 5.5 + radius / 70 + 2 * (0.0235) * radius + 2 * (0.04) * radius + (i - 4) * (0.052) * radius;
		}
		else if (i < 11)
		{
			y1 = centerY - radius / 5.5 + radius / 70 + 2 * (0.0235) * radius + 2 * (0.04) * radius + 4 * (0.052) * radius + (i - 8) * 0.04 * radius;
		}
		else
			y1 = centerY - radius / 5.5 + radius / 70 + 2 * (0.0235) * radius + 2 * (0.04) * radius + 4 * (0.052) * radius + 2 * 0.04 * radius + (i - 10) * 0.0235 * radius;
		
		float x2 = centerX + radius / 2.5 + radius / 8.88 + radius * 0.015;
		float y2 = y1;
		
		setcolor(WHITE);
		if (flag == 0)
			setlinestyle(SOLID_LINE, 0, 1);
		else setlinestyle(SOLID_LINE, 0, 1.2);
		
		ege_line(x1, y1, x2, y2);
		
	}
	
	
	setcolor(WHITE);
	setfont(0.05 * radius, 0.025 * radius, "Bahnschrift");
	
	if (verticalSpeed >= 0)
	{
		char str[10];
		sprintf(str, "%d", (int)verticalSpeed);
		outtextxy(centerX + radius / 2.5 + 2 * radius / 25 + radius * 0.015, centerY - radius / 5.5 - 0.05 * radius, str);
	}
	else
	{
		char str[10];
		sprintf(str, "%d", (int)verticalSpeed);
		outtextxy(centerX + radius / 2.5 + 2 * radius / 25 + radius * 0.015, centerY + radius / 5.5 + radius / 8, str);
	}
	
	
	
	for (int i = 0; i < 13; i = i + 2)
	{
		setcolor(WHITE);
		setbkmode(TRANSPARENT);
		setfont((int)(0.03 * radius), (int)(0.015 * radius), "Bahnschrift");
		float x1;
		x1 = centerX + radius / 2.5 + radius / 10 - radius * 0.015 + radius * 0.015;
		
		float y1;
		
		if (i <= 2)
		{
			y1 = centerY - radius / 5.5 + radius / 70 + i * (0.0235) * radius - radius * 0.015;
		}
		else if (i < 5)
		{
			y1 = centerY - radius / 5.5 + radius / 70 + 2 * (0.0235) * radius + (i - 2) * (0.04) * radius - radius * 0.015;
		}
		else if (i <= 8)
		{
			y1 = centerY - radius / 5.5 + radius / 70 + 2 * (0.0235) * radius + 2 * (0.04) * radius + (i - 4) * (0.052) * radius - radius * 0.015;
		}
		else if (i < 11)
		{
			y1 = centerY - radius / 5.5 + radius / 70 + 2 * (0.0235) * radius + 2 * (0.04) * radius + 4 * (0.052) * radius + (i - 8) * 0.04 * radius - radius * 0.015;
		}
		else
			y1 = centerY - radius / 5.5 + radius / 70 + 2 * (0.0235) * radius + 2 * (0.04) * radius + 4 * (0.052) * radius + 2 * 0.04 * radius + (i - 10) * 0.0235 * radius - radius * 0.015;
		
		char str[10];
		int M;
		if (i < 3)
			M = 6 - i * 2;
		else if (i > 3 && i < 7)
			M = 3 - i / 2;
		else if (i > 7 && i < 9)
			M = 3 - (12 - i) / 2;
		else
			M = 6 - (12 - i) * 2;
		sprintf(str, "%d", M);
		outtextxy(x1, y1, str);
		
	}
	
	setcolor(EGERGB(205, 48, 219));
	setlinestyle(SOLID_LINE, 0, 4);
	float x1 = centerX + radius / 2.5 + radius / 10 + radius * 0.015;
	float y1 = centerY - radius / 5.5 + radius / 70 + 2 * (0.0235) * radius + 2 * (0.04) * radius + (6 - 4) * (0.052) * radius;
	float x2, y2;
	x2 = centerX + radius / 2.5 + radius / 10 + radius / 40 + radius * 0.015;
	y2 = y1;
	ege_line(x1, y1, x2, y2);
	
	double verticalAngle = 0;
	double speed = verticalSpeed;
	double r = 0;
	int flag = 0;
	if (verticalSpeed < 0)
	{
		speed = -verticalSpeed;
		flag = 1;
	}
	if (speed <= 100)
	{
		verticalAngle = ((PI / 2.7 / 100) * speed) - PI / 2;
		r = (radius / 21 + radius * speed / 1500);
	}
	else if (speed <= 200)
	{
		verticalAngle = PI / 2.7 + (PI / 18) / 100 * (speed - 100) - PI / 2;
		r = (radius / 21 + radius * speed / 1500);
	}
	else if (speed <= 600)
	{
		verticalAngle = PI / 2.7 + PI / 18 + (PI / 1200) / 400 * (speed - 200) - PI / 2;
		r = (radius / 21 + 2 * radius / 15 + radius * (speed - 200) / 8000);
	}
	else
	{
		verticalAngle = PI / 2.7 + PI / 18 + PI / 1200 - PI / 2;
		r = (radius / 21 + 2 * radius / 15 + radius / 16);
	}
	
	if (flag == 1)
		verticalAngle = -verticalAngle + PI;
	
	setcolor(WHITE);
	setlinestyle(SOLID_LINE, 0, 1.5);
	float x_1 = centerX + radius / 2.5 + radius / 6.5 + radius * 0.015;
	float y_1 = centerY - radius / 5.5 + radius / 70 + 2 * (0.0235) * radius + 2 * (0.041) * radius + 2 * (0.0515) * radius;
	
	float x_2, y_2;
	x_2 = x_1 + r * sin(verticalAngle);
	y_2 = y_1 - r * cos(verticalAngle);
	ege_line(x_1, y_1, x_2, y_2);
	
}

void drawMakeBigHeight(float centerX, float centerY, float radius, double height)
{
	//高度表放大框
	setfillcolor(EGERGB(15, 15, 15));
	ege_point BorderMeterXY[] = {
		{centerX + 0.325 * radius, centerY + 0.06 * radius } ,
		{centerX + 0.35 * radius, centerY + 0.04 * radius} ,
		{centerX + 0.35 * radius, centerY + 0.015 * radius} ,
		{centerX + 0.515 * radius, centerY + 0.015 * radius} ,
		
		{centerX + 0.515 * radius, centerY + 0.11 * radius} ,
		{centerX + 0.35 * radius, centerY + 0.11 * radius} ,
		{centerX + 0.35 * radius, centerY + 0.08 * radius} ,
		{centerX + 0.325 * radius, centerY + 0.06 * radius} ,
	};
	ege_fillpoly(8, BorderMeterXY);
	
	//白色边框 
	setcolor(WHITE);
	setlinestyle(SOLID_LINE, 0, 2);
	ege_point BorderMeterXY2[] = {
		{centerX + 0.325 * radius, centerY + 0.06 * radius } ,
		{centerX + 0.35 * radius, centerY + 0.04 * radius} ,
		{centerX + 0.35 * radius, centerY + 0.015 * radius} ,
		{centerX + 0.515 * radius, centerY + 0.015 * radius} ,
		
		{centerX + 0.515 * radius, centerY + 0.11 * radius} ,
		{centerX + 0.35 * radius, centerY + 0.11 * radius} ,
		{centerX + 0.35 * radius, centerY + 0.08 * radius} ,
		{centerX + 0.325 * radius, centerY + 0.06 * radius}
	};
	ege_drawpoly(8, BorderMeterXY2);
	
	int hw = (int)height / 10000;
	
	if (hw == 0)
	{
		setcolor(WHITE);
		setfillcolor(GREEN);
		bar(centerX + 0.355 * radius, centerY + 0.038 * radius, centerX + 0.385 * radius, centerY + 0.083 * radius);
	}
	else
	{
		char strw[10];
		setcolor(WHITE);
		setfont(0.075 * radius, 0.045 * radius, "Bahnschrift");
		sprintf(strw, "%d", hw);
		outtextxy(centerX + 0.358 * radius, centerY + 0.021 * radius, strw);
	}
	
	setcolor(WHITE);
	setbkmode(TRANSPARENT);
	
	int hq = (int)(height / 1000) % 10;
	setfont((int)(0.075 * radius), (int)(0.045 * radius), "Bahnschrift");
	char strq[10];
	setcolor(WHITE);
	sprintf(strq, "%d", hq);
	outtextxy(centerX + 0.388 * radius, centerY + 0.022 * radius, strq);
	
	int hb = (int)(height / 100) % 10;
	setfont((int)(0.06 * radius), (int)(0.035 * radius), "Bahnschrift");
	char strb[10];
	setcolor(WHITE);
	sprintf(strb, "%d", hb);
	outtextxy(centerX + 0.435 * radius, centerY + 0.028 * radius, strb);
	
	//滚动部分 
	
	int h = (int)height % 100;
	
	double i = 0;
	i = -(0.055 * radius) / 22 * h;
	
	
	setcolor(WHITE);
	setbkmode(TRANSPARENT);
	setfont((int)(0.055 * radius), (int)(0.023 * radius), "Bahnschrift");
	
	if (centerY + 0.02 * radius + 0.05 * radius - i <= centerY + 0.11 * radius && centerY + 0.02 * radius + 0.05 * radius - i >= centerY - 0.035 * radius)
		outtextxy(centerX + 0.47 * radius, centerY + 0.02 * radius + 0.05 * radius - i, "80");
	if (centerY + 0.02 * radius - i <= centerY + 0.11 * radius && centerY + 0.02 * radius - i >= centerY - 0.035 * radius)
		outtextxy(centerX + 0.47 * radius, centerY + 0.02 * radius - i, "00");
	if (centerY + 0.02 * radius - 0.05 * radius * 1 - i <= centerY + 0.11 * radius && centerY + 0.02 * radius - 0.05 * radius * 1 - i >= centerY - 0.035 * radius)
		outtextxy(centerX + 0.47 * radius, centerY + 0.02 * radius - 0.05 * radius * 1 - i, "20");
	if (centerY + 0.02 * radius - 0.05 * radius * 2 - i <= centerY + 0.11 * radius && centerY + 0.02 * radius - 0.05 * radius * 2 - i >= centerY - 0.035 * radius)
		outtextxy(centerX + 0.47 * radius, centerY + 0.02 * radius - 0.05 * radius * 2 - i, "40");
	if (centerY + 0.02 * radius - 0.05 * radius * 3 - i <= centerY + 0.11 * radius && centerY + 0.02 * radius - 0.05 * radius * 3 - i >= centerY - 0.035 * radius)
		outtextxy(centerX + 0.47 * radius, centerY + 0.02 * radius - 0.05 * radius * 3 - i, "60");
	if (centerY + 0.02 * radius - 0.05 * radius * 4 - i <= centerY + 0.11 * radius && centerY + 0.02 * radius - 0.05 * radius * 4 - i >= centerY - 0.035 * radius)
		outtextxy(centerX + 0.47 * radius, centerY + 0.02 * radius - 0.05 * radius * 4 - i, "80");
	if (centerY + 0.02 * radius - 0.05 * radius * 5 - i <= centerY + 0.11 * radius && centerY + 0.02 * radius - 0.05 * radius * 5 - i >= centerY - 0.035 * radius)
		outtextxy(centerX + 0.47 * radius, centerY + 0.02 * radius - 0.05 * radius * 5 - i, "00");
	
	
	setfillcolor(BLACK);
	bar(centerX + 0.46 * radius, centerY - 0.035 * radius, centerX + radius / 2.5 + 2 * radius / 25 + radius * 0.015, centerY + 0.014 * radius);
	setfillcolor(EGERGB(28, 28, 31));
	bar(centerX + radius / 2.5 + 2 * radius / 25 + radius * 0.015, centerY - 0.035 * radius, centerX + 0.514 * radius, centerY + 0.014 * radius);
	setfillcolor(BLACK);
	bar(centerX + 0.46 * radius, centerY + 0.11 * radius, centerX + radius / 2.5 + 2 * radius / 25 + radius * 0.015, centerY + 0.16 * radius);
	setfillcolor(EGERGB(28, 28, 31));
	bar(centerX + radius / 2.5 + 2 * radius / 25 + radius * 0.015, centerY + 0.11 * radius, centerX + 0.514 * radius, centerY + 0.16 * radius);
	ege_drawpoly(8, BorderMeterXY2);
}

void drawMakeBigSpeed(float centerX, float centerY, float radius, double speed)
{
	//空速表放大框
	setfillcolor(EGERGB(15, 15, 15));//WHITE
	ege_point BorderSpeedXY[] = {
		{centerX - radius / 3.5 - 0.025 * radius , centerY - radius / 3 + 0.43 * radius } ,
		{centerX - radius / 3.5 - 0.045 * radius , centerY - radius / 3 + 0.43 * radius - 0.025 * radius} ,
		{centerX - radius / 3.5 - 0.045 * radius , centerY - radius / 3 + 0.43 * radius - 0.06 * radius} ,
		{centerX - radius / 3.5 - 0.15 * radius , centerY - radius / 3 + 0.43 * radius - 0.06 * radius} ,
		
		{centerX - radius / 3.5 - 0.15 * radius , centerY - radius / 3 + 0.43 * radius + 0.06 * radius} ,
		{centerX - radius / 3.5 - 0.045 * radius , centerY - radius / 3 + 0.43 * radius + 0.06 * radius} ,
		{centerX - radius / 3.5 - 0.045 * radius , centerY - radius / 3 + 0.43 * radius + 0.025 * radius} ,
		{centerX - radius / 3.5 - 0.025 * radius , centerY - radius / 3 + 0.43 * radius}
	};
	ege_fillpoly(8, BorderSpeedXY);
	
	//白色边框
	setcolor(WHITE);
	setlinestyle(SOLID_LINE, 0, 2);
	ege_point BorderSpeedXY2[] = {
		{centerX - radius / 3.5 - 0.025 * radius , centerY - radius / 3 + 0.43 * radius } ,
		{centerX - radius / 3.5 - 0.045 * radius , centerY - radius / 3 + 0.43 * radius - 0.025 * radius} ,
		{centerX - radius / 3.5 - 0.045 * radius , centerY - radius / 3 + 0.43 * radius - 0.06 * radius} ,
		{centerX - radius / 3.5 - 0.15 * radius , centerY - radius / 3 + 0.43 * radius - 0.06 * radius} ,
		
		{centerX - radius / 3.5 - 0.15 * radius , centerY - radius / 3 + 0.43 * radius + 0.06 * radius} ,
		{centerX - radius / 3.5 - 0.045 * radius , centerY - radius / 3 + 0.43 * radius + 0.06 * radius} ,
		{centerX - radius / 3.5 - 0.045 * radius , centerY - radius / 3 + 0.43 * radius + 0.025 * radius} ,
		{centerX - radius / 3.5 - 0.025 * radius , centerY - radius / 3 + 0.43 * radius}
	};
	ege_drawpoly(8, BorderSpeedXY2);
	
	setfont((int)(0.08 * radius), (int)(0.035 * radius), "Bahnschrift");
	int sb = (int)(speed / 100) % 10;
	
	if (sb != 0)
	{
		char strsb[10];
		setcolor(WHITE);
		sprintf(strsb, "%d", sb);
		setfont((int)(0.08 * radius), (int)(0.034 * radius), "Bahnschrift");
		outtextxy(centerX - radius / 3.5 - 0.14 * radius, centerY - radius / 3 + 0.43 * radius - 0.04 * radius, strsb);
	}
	
	setcolor(WHITE);
	setbkmode(TRANSPARENT);
	
	int ss = (int)(speed / 10) % 10;
	char strss[10];
	setcolor(WHITE);
	setfont((int)(0.08 * radius), (int)(0.035 * radius), "Bahnschrift");
	sprintf(strss, "%d", ss);
	outtextxy(centerX - radius / 3.5 - 0.11 * radius, centerY - radius / 3 + 0.43 * radius - 0.04 * radius, strss);
	
	//滚动部分 
//	int angle = (speed % 100)/360; 
	int s = (int)speed % 10;
	
	double j = 0;
	j = -(0.065 * radius) * s;
	
	setcolor(WHITE);
	setbkmode(TRANSPARENT);
	setfont((int)(0.08 * radius), (int)(0.031 * radius), "Bahnschrift");
	
	if (centerY - radius / 3 + 0.39 * radius + 0.06 * radius - j <= centerY - radius / 3 + 0.49 * radius && centerY - radius / 3 + 0.39 * radius + 0.06 * radius - j >= centerY - radius / 3 + 0.28 * radius)
		outtextxy(centerX - radius / 3.5 - 0.075 * radius, centerY - radius / 3 + 0.39 * radius + 0.07 * radius - j, "9");
	if (centerY - radius / 3 + 0.39 * radius - j <= centerY - radius / 3 + 0.49 * radius && centerY - radius / 3 + 0.43 * radius - 0.04 * radius - j >= centerY - radius / 3 + 0.28 * radius)
		outtextxy(centerX - radius / 3.5 - 0.075 * radius, centerY - radius / 3 + 0.39 * radius - j, "0");
	if (centerY - radius / 3 + 0.39 * radius - 0.06 * radius - j <= centerY - radius / 3 + 0.49 * radius && centerY - radius / 3 + 0.39 * radius - 0.06 * radius - j >= centerY - radius / 3 + 0.28 * radius)
		outtextxy(centerX - radius / 3.5 - 0.075 * radius, centerY - radius / 3 + 0.39 * radius - 0.06 * radius - j, "1");
	if (centerY - radius / 3 + 0.39 * radius - 0.06 * radius * 2 - j <= centerY - radius / 3 + 0.49 * radius && centerY - radius / 3 + 0.39 * radius - 0.06 * radius * 2 - j >= centerY - radius / 3 + 0.28 * radius)
		outtextxy(centerX - radius / 3.5 - 0.075 * radius, centerY - radius / 3 + 0.39 * radius - 0.06 * radius * 2 - j, "2");
	if (centerY - radius / 3 + 0.39 * radius - 0.06 * radius * 3 - j <= centerY - radius / 3 + 0.49 * radius && centerY - radius / 3 + 0.39 * radius - 0.06 * radius * 3 - j >= centerY - radius / 3 + 0.28 * radius)
		outtextxy(centerX - radius / 3.5 - 0.075 * radius, centerY - radius / 3 + 0.39 * radius - 0.06 * radius * 3 - j, "3");
	if (centerY - radius / 3 + 0.39 * radius - 0.06 * radius * 4 - j <= centerY - radius / 3 + 0.49 * radius && centerY - radius / 3 + 0.39 * radius - 0.06 * radius * 4 - j >= centerY - radius / 3 + 0.28 * radius)
		outtextxy(centerX - radius / 3.5 - 0.075 * radius, centerY - radius / 3 + 0.39 * radius - 0.06 * radius * 4 - j, "4");
	if (centerY - radius / 3 + 0.39 * radius - 0.06 * radius * 5 - j <= centerY - radius / 3 + 0.49 * radius && centerY - radius / 3 + 0.39 * radius - 0.06 * radius * 5 - j >= centerY - radius / 3 + 0.28 * radius)
		outtextxy(centerX - radius / 3.5 - 0.075 * radius, centerY - radius / 3 + 0.39 * radius - 0.06 * radius * 5 - j, "5");
	if (centerY - radius / 3 + 0.39 * radius - 0.06 * radius * 6 - j <= centerY - radius / 3 + 0.49 * radius && centerY - radius / 3 + 0.39 * radius - 0.06 * radius * 6 - j >= centerY - radius / 3 + 0.28 * radius)
		outtextxy(centerX - radius / 3.5 - 0.075 * radius, centerY - radius / 3 + 0.39 * radius - 0.06 * radius * 6 - j, "6");
	if (centerY - radius / 3 + 0.39 * radius - 0.06 * radius * 7 - j <= centerY - radius / 3 + 0.49 * radius && centerY - radius / 3 + 0.39 * radius - 0.06 * radius * 7 - j >= centerY - radius / 3 + 0.28 * radius)
		outtextxy(centerX - radius / 3.5 - 0.075 * radius, centerY - radius / 3 + 0.39 * radius - 0.06 * radius * 7 - j, "7");
	if (centerY - radius / 3 + 0.39 * radius - 0.06 * radius * 8 - j <= centerY - radius / 3 + 0.49 * radius && centerY - radius / 3 + 0.39 * radius - 0.06 * radius * 8 - j >= centerY - radius / 3 + 0.28 * radius)
		outtextxy(centerX - radius / 3.5 - 0.075 * radius, centerY - radius / 3 + 0.39 * radius - 0.06 * radius * 8 - j, "8");
	if (centerY - radius / 3 + 0.39 * radius - 0.06 * radius * 9 - j <= centerY - radius / 3 + 0.49 * radius && centerY - radius / 3 + 0.39 * radius - 0.06 * radius * 9 - j >= centerY - radius / 3 + 0.28 * radius)
		outtextxy(centerX - radius / 3.5 - 0.075 * radius, centerY - radius / 3 + 0.39 * radius - 0.06 * radius * 9 - j, "9");
	if (centerY - radius / 3 + 0.39 * radius - 0.06 * radius * 10 - j <= centerY - radius / 3 + 0.49 * radius && centerY - radius / 3 + 0.39 * radius - j - 0.06 * radius * 10 >= centerY - radius / 3 + 0.28 * radius)
		outtextxy(centerX - radius / 3.5 - 0.075 * radius, centerY - radius / 3 + 0.39 * radius - j - 0.06 * radius * 10, "0");
	
	setfillcolor(EGERGB(28, 28, 31));
	bar(centerX - radius / 3.5 - 0.1 * radius, centerY - radius / 3 + 0.43 * radius - 0.15 * radius, centerX - radius / 3.5 - 0.04 * radius, centerY - radius / 3 + 0.43 * radius - 0.0615 * radius);
	bar(centerX - radius / 3.5 - 0.1 * radius, centerY - radius / 3 + 0.43 * radius + 0.065 * radius, centerX - radius / 3.5 - 0.04 * radius, centerY - radius / 3 + 0.43 * radius + 0.15 * radius);
	ege_drawpoly(8, BorderSpeedXY2);
}

void drawSround(int width,int length,float centerX, float centerY, float radius, double height, double speed, double HIangle, double verticalSpeed)
{
	//灰色方块
	drawBar(centerX, centerY, radius);
	//文字
	drawFront(centerX, centerY, radius);
	//垂直速度表
	drawVerticalSpeed(centerX, centerY, radius,verticalSpeed);
	//高度表
	drawAltimeter(centerX, centerY, radius, height);
	//放大器
	drawMakeBigHeight(centerX, centerY, radius, height);
	//空速表
	drawAirspeed(centerX, centerY, radius, speed);
	//放大器
	drawMakeBigSpeed(centerX, centerY, radius, speed);
	//空速表数字 
	SpeedMember(centerX, centerY, radius, speed);
	//航向指示仪
	drawHeadingIndicator(width, length, centerX, centerY, radius,HIangle);
	
}


void drawPDF(int width, int length, float centerX, float centerY, float radius, float move_cx,float move_cy, float attitudeAngle, float updown, float height, float Airspeed,float HIangle,float verticalSpeed )
{
	kuang(centerX, centerY, radius * 0.28);
	drawMovedAttitude(width, length, centerX, centerY, move_cx, move_cy, radius, attitudeAngle, updown);
	drawPointer(width, length, centerX, centerY, radius, attitudeAngle);
	drawPFDBack(centerX, centerY, radius);
	drawSround(width, length,centerX, centerY, radius, height, Airspeed, HIangle,verticalSpeed);
}

int main()
{
	// 初始化图形窗口
	int width = 800, length = 800;
	initgraph(width, length, INIT_NOFORCEEXIT);
	ege_enable_aa(true);
	//仪表背景色
	setrendermode(RENDER_MANUAL);
	setbkcolor(EGERGB(180, 180, 180));
	cleardevice();
	float centerX = 400;
	float centerY = 300;
	float radius = 400;
	
	float move_cx = centerX;
	float move_cy = centerY;	//蓝棕色移动坐标
	float attitudeAngle = 0;	//姿态仪旋转角
	float updown = 0;	//姿态仪俯仰角
	
	double height = 0;
	double Airspeed = 30;
	double verticalSpeed = 0;
	double HIangle = 0;
	
	while (1)
	{
		// 清屏
		cleardevice();				
		drawPDF(width,length, centerX, centerY, radius, move_cx, move_cy, attitudeAngle, updown, height, Airspeed, HIangle, verticalSpeed );
		delay_ms(60);
	}
	
	getch();
	closegraph();
	return 0;
}
